package charazay.tool.ihm.menu;

import java.awt.Container;
import java.util.Locale;
import java.util.ResourceBundle;

import javax.swing.Box;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.JMenuBar;


import charazay.tool.misc.Session;

public class CharazayMenu extends JMenuBar {
	private Locale currentLocale = new Locale(Session.language, Session.country);
    private ResourceBundle messages = ResourceBundle.getBundle("charazay.tool.locale.Internationalization", currentLocale);
	
    /* Menu Fichiers*/
    private JMenu files = new JMenu(messages.getString("Files"));
    private JMenu update = new JMenu(messages.getString("Update"));
    public JMenuItem players = new JMenuItem(messages.getString("Players"));
    public JMenuItem matchs = new JMenuItem(messages.getString("Matchs"));
    public JMenuItem division = new JMenuItem(messages.getString("Division"));
    public JMenuItem all = new JMenuItem(messages.getString("All"));
    
    private JMenu ftp = new JMenu(messages.getString("FTP"));
    public JMenuItem download = new JMenuItem(messages.getString("Download"));
    public JMenuItem upload = new JMenuItem(messages.getString("Upload"));
    private JMenu xml = new JMenu(messages.getString("Import_XML"));
    public JMenuItem player = new JMenuItem(messages.getString("Player"));
    public JMenuItem match = new JMenuItem(messages.getString("Match"));
    public JMenuItem exit = new JMenuItem(messages.getString("Exit"));
    
    /* Menu Options*/
    private JMenu options = new JMenu(messages.getString("Options"));
    public JMenuItem ftp_settings = new JMenuItem(messages.getString("FTP_site"));
    public JMenuItem settings = new JMenuItem(messages.getString("Settings"));
    
    /* Menu Outils*/
    private JMenu tools = new JMenu(messages.getString("Tools"));
    
    /* Menu About*/
    private JMenu misc_menu = new JMenu("?");
    public JMenuItem about = new JMenuItem(messages.getString("About"));
	
	public CharazayMenu() {
		super();
		buildMenu();
	}
	
	public void buildMenu() {
		/*Menu fichiers */
		
		files.add(update);
		update.add(players);
		update.add(matchs);
		update.add(division);
		update.add(all);
		
		files.add(ftp);
		ftp.add(download);
		ftp.add(upload);
		files.addSeparator();
		xml.add(player);
		xml.add(match);
		files.add(xml);
		files.addSeparator();
		files.add(exit);
		add(files);
		
		/*Menu outils*/
		add(tools);
		
		/*Menu options*/
		options.add(ftp_settings);
		options.add(settings);
		add(options);
		
		/*Menu about*/
		add(Box.createHorizontalGlue());
		misc_menu.add(about);
		add(misc_menu);
	}
	
}
